package com.zhao.query.srv;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zhao.message.api.MessageDubboService;
import com.zhao.message.api.MessageFeignService;
import com.zhao.query.api.QueryFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created on 2019/7/22.
 *
 * @author zhao
 * @email 136689260@qq.com
 */
@RestController
public class QueryController implements QueryFeignService {

    @Autowired
    private MessageFeignService messageFeignService;

    @Reference(lazy = true, check = false)
    private MessageDubboService messageDubboService;

    @RequestMapping("/messageFeign/{message}")
    public String messageFeign(@PathVariable("message") String message) {
        return messageFeignService.messageFeign(message);
    }

    @RequestMapping("/messageDubbo/{message}")
    public String messageDubbo(@PathVariable("message") String message) {
        return messageDubboService.messageDubbo(message);
    }

    @Override
    public String queryFeign(String message) {
        return "queryFeign message is" + message;
    }
}
